/**
 * 
 */
package br.ufal.ic.sd.project.server.enumeration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author keven andrade
 *
 */
public enum Replicator {
    
    SENDER(1, "SENDER"),
    RECEIVER(2, "RECEIVER");
    
    private int intId;
    private String strReplicatorMode;
    
    /**
     * @Construtor
     * @param intId
     * @param strReplicatorMode
     */
    private Replicator(int intId, String strReplicatorMode) {
	
	this.intId = intId;
	this.strReplicatorMode = strReplicatorMode;
	
    }
    
    /**
     * @return the intId
     */
    public int getIntId() {
        return intId;
    }

    /**
     * @param intId the intId to set
     */
    public void setIntId(int intId) {
        this.intId = intId;
    }

    /**
     * @return the strReplicatorMode
     */
    public String getStrReplicatorMode() {
        return strReplicatorMode;
    }



    /**
     * @param strReplicatorMode the strReplicatorMode to set
     */
    public void setStrReplicatorName(String strReplicatorMode) {
        this.strReplicatorMode = strReplicatorMode;
    }



    /**
     * @return a list of Replicator's
     */
    public static List<Replicator> getListCommand() {

	List<Replicator> listReplicator = new ArrayList<Replicator>();
	int i = 1;

	while (Replicator.getCommand(i) != null) {
	    listReplicator.add(Replicator.getCommand(i++));
	}
	return listReplicator;
    }
    
    /**
     * @return a Replicator by is id
    */
    public static Replicator getCommand(int intId) {
	
	switch (intId) {
		case 1:
		    return Replicator.SENDER;
		case 2:
		    return Replicator.RECEIVER;
		default:
		    return null;
	}
}

}
